package com.xiyuan.smartutils.extend;

import java.io.Serializable;

/**
 * KV对象定义，[key, value]成对出现
 *
 * @version v1.0.0 @author lgz 2018-7-20 新建与整理
 */
public final class KV<K, V> implements Serializable {
    private static final long serialVersionUID = 1L;
    private K key;
    private V value;
    
    private String desc;
    
    public KV() {}
    
    public KV(K key, V value) {
        this.key = key;
        this.value = value;
    }
    
    public K key() {
        return key;
    }
    
    public KV<K, V> key(K key) {
        this.key = key;
        return this;
    }
    
    public V value() {
        return value;
    }
    
    public KV<K, V> value(V value) {
        this.value = value;
        return this;
    }
    
    public String getDesc() {
        return desc;
    }
    
    public void setDesc(String desc) {
        this.desc = desc;
    }
    
    public String toString() {
        return new StringBuilder("{").append("K= ")
                .append(key)
                .append(";")
                .append("V= ")
                .append(value)
                .append(";")
                .append("Descs ")
                .append(desc)
                .append("}")
                .toString();
    }
}
